@extends('front.common.header')

@section('title',$result->name.' - 充电加油')

@section('head')
@parent
@stop

@section('content')
<link href="{{ asset('/css/employ/list.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/jobs.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<div class="main">
    <div class="content">
        <div class='top-nav'>
    		<ul>
    		  {!! $mianbaoxie !!}
    		</ul>
    	</div>
    </div>
    @if (count($errors) > 0)
    @foreach ($errors->all() as $error)
    @if($error == '2008')
    <script type="text/javascript">
    	ShowLogin('MyDiv','fade');
    </script>
    @endif
    @endforeach
	@endif
    <div class="employ-list">
        <div class="employ-list-left fl">
            <div class="employ-search mb20">
                <div class="employ-line"> 
                    <div class='course-info-img float-l'>
                        <img  src="@if(count($result->attachment)>0) {{$result->attachment->url}} @else {{asset('/images/t-nopic.jpg')}} @endif"/>
                    </div>
                    <div class="course-info float-l">
                        <div class="course-info-title" >
                            <span>{{$result->name}}</span>
                        </div>
                        <div class="course-info-tilte2">
                            <div class="float-l">
                                学习人数&nbsp;&nbsp;<span class="color-orange">{{$result->studys_num}}</span>
                            </div>
                            <div class="float-l ml-10">
                                评论数量&nbsp;&nbsp;<span class="color-orange">{{$result->comments_num}}</span>
                            </div>
                            <div class="float-l ml-10">
                                分享
                            </div>
                            <div class="bdsharebuttonbox float-l ml-10"><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a></div>
                            <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":["qzone","tsina","weixin","douban"],"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
                            <div class="clearfix"></div>
                        </div>
                        <div class="course-notice-title">学习须知</div>
                        <div class='course-notice-content'>
                            <p>
                            {{$result->notice}}
                            </p>
                        </div>                        
                        <div class="course-info-action">
                            
                            <div class="course-info-button float-l" onclick="toStudy(this,'/teaches/content','{{$result->id}}','{{csrf_token()}}',0)">
                                @if(count($result->studying)>0) 
                                继续学习 
                                @else 
                                开始学习 
                                @endif
                            </div>
                            @if(empty($result->is_collect) || $result->is_collect == 0)
                            <a class="fml-10 ont-14 color-gray float-l" href="javascript:void(0);" onclick="toCollect('/member/collect','teaches','{{$result->id}}','{{ csrf_token()}}','{{empty($authuser)?0:$authuser->id}}')">
                                <span class=" font-14 color-gray" id="collect_num">
                                    收藏(<span>{{$result->attention_num}}</span>)
                                </span>
                            </a>
                            @else
                            <span class="ml-10 font-14 color-gray float-l">已收藏({{$result->attention_num}})</span>
                            @endif
                        </div>    
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="boderbottom"></div>
                <div class="employ-line mt-10">
                    <div class="course-dec-title">
                        <div class="course-desc-left-icon float-l"></div>
                        <div class="course-desc-title float-l">课程简介</div>
                        <div class="course-desc-dashed float-l"></div>
                        <div class="course-desc-right float-r cp"><i class="icon-double-angle-down" onclick="toShowOrHide(this,'course_desc_content')"></i></div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="course-desc-content" id="course_desc_content">
                        {!! $result->description !!}
                    </div>
                </div>
                <script type="text/javascript">
					function toShowOrHide(id,showid)
					{
						if($("#"+showid).hasClass('hide')){
							$(id).parent().removeClass('my-xwei-transform');
							$("#"+showid).removeClass('hide');
						}else{
							$(id).parent().addClass('my-xwei-transform');
							$("#"+showid).addClass('hide');
						}
					}
                </script>
                <div class="employ-line mt-10">
                    <div class="course-dec-title">
                        <div class="course-desc-left-icon float-l"></div>
                        <div class="course-desc-title float-l">课程目录</div>
                        <div class="course-desc-dashed float-l"></div>
                        <div class="course-desc-right float-r cp"><i class="icon-double-angle-down" onclick="toShowOrHide(this,'course_list')"></i></div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="course-desc-content" id="course_list">
                        @if(count($result->chapters)>0)
                        @foreach($result->chapters as $key=>$chap)
                        <div class="@if($key==0)mt-10 @else mt-30 @endif">
                            <p class="course-desc-chapter"><i class="icon-circle"></i>&nbsp;&nbsp;{{$chap->name}}</p>
                            @if(count($chap->contents)>0)
                            @foreach($chap->contents as $clas)
                           	<p>
                           		<a href="javascript:void(0);" onclick="toStudy(this,'/teaches/content','{{$result->id}}','{{csrf_token()}}',{{$clas->id}})">
                           			<span class="font-14 color-10">{{$clas->name}}</span>
           						</a>
       						</p>
                            @endforeach
                            @endif
                        </div>
                        @endforeach
                        @endif
                    </div>
                </div>
            </div>
            <div id="com-comments-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">全部评论</h4>
                <div id="itemContainer" >
                    @foreach($comments as $k=>$vo)
                    <div class="comment-common" id="comment-common{{$k}}">
                        <div class="comment-user-avatar fl pt10">
                            <img src="{{userlogo($vo->user_id,'middle')}}">
                        </div>
                        <div class="comment-main fl">
                            <div class="comment-content text-left">
                                <p class="font-20 c3">{{getUserName($vo->user_id)}}</p>
                                <p class="fs14 c5">{{$vo->content}}</p>
                                <div class="fs14 c9 ma0">
                                    <div class="fl">
                                        {{$vo->created_at}}&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="showreply({{$vo->comment_id}})">回复</a>
                                    </div>
                                    <div class="fr mr15">
                                        <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}">
                                        @if(count($vo->childComments)>0)
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="{{count($vo->childComments)}}" readonly="readonly">
                                        @else
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="0" readonly="readonly">
                                        @endif
                                    </div>
                                    <div class="clr"></div>
                                </div>
                            </div>
                            <div id="comment-reply{{$vo->comment_id}}" class="comment-reply-form mt20 dn">
                                <div class="comment-reply-form-b">
                                    <textarea id="comment-reply-content{{$vo->comment_id}}" class="fl" placeholder="人可以走,留下你的态度"></textarea>
                                    <button type="button" id="submit{{$vo->comment_id}}" class="fr" @if(empty($authuser))onclick="loginTips()" @else onclick="tpushComment('/comment/push?typeid=5','{{$vo->comment_id}}','{{$vo->user_id}}','teaches','{{$result->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                                </div>
                            </div>
                            <div id="message{{$vo->comment_id}}" class="commentmsg dn"></div>
                            <div class="comment-child text-left" id="comment-childs{{$vo->comment_id}}">
                                @if(count($vo->childComments)>0)
                                <div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>
                                <div class="comment-child-content" id="comment-child-content{{$vo->comment_id}}">
                                    @foreach($vo->childComments as $key=>$zn)
                                    @if($key<3)
                                    <div class="comment-child-content-list" >
                                        <p class="fs18 color-green">{{$zn->user->name}}：</p>
                                        <p class="fs14 c5">{{$zn->content}}</p>
                                    </div>
                                    @endif
                                    @endforeach
                                </div>
                                @endif
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>
                    @endforeach
                </div>
                {{-- 分页 --}}
                <div id="holder" @if(count($comments)== 0) class="holder dn" @else class="holder" @endif></div>
                <script>
                 jPages();
                </script>
                <div class="comment-reply-main">
                   <textarea id="comment-reply-content" placeholder="人可以走,留下你的态度"></textarea>
                    <div class="mb20 lh44 mt10">
                       <div id="message" class="fl"></div>
                       <button type="button" class="fr" id="submit-main" @if(empty($authuser))onclick="loginTips()" @else onclick="tcomment('/comment/push?typeid=5','teaches','{{$result->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="employ-list-right fl">
            <div class="employ-list-tips">
	           <div class="tips-title">人气热点</div>
	           @foreach($teachesHot as $k=>$thots)
	           <div class="tips-content @if($k>0) bodertop @endif">
	               <div class="tips-content-main">
    	               <div class="tips-content-title"><a href="{{url('/teaches/'.$thots->id)}}">{{ str_limit($thots->name,24)}}</a></div>
    	               <div class="tips-content-views">阅读（ {{ $thots->views_num }} ）</div>
	               </div>
	           </div>
	           @endforeach
	       </div>
	       @foreach ($ads_img as $key => $adimg)
	       <div class="employ-list-tips mt-10">
	           <img src="{{$adimg->attachment($adimg->id)->url}}">
	       </div>
	       @endforeach
        </div>
        <div class="clearfix"></div>
    </div>
</div>
@stop

<!--底部导航-->
@section('footer')
@parent
@stop